//****Copywrite CoastWorx http://www.coastworx.com Version 1.1******
//****Please make a donation if you wish to remove this notice!******
var freezeRow = 1; //change to row to freeze at
var freezeCol = 1; //change to column to freeze at
var myRow = freezeRow;
var myCol = freezeCol;
var speed = 100; //timeout speed
var mytable;
var noRows;
var myCells, ID;

function setUp(){
    if(!mytable) {
        mytable=document.getElementById("data-table");
    }
    myCells = mytable.rows[0].cells.length;
    noRows=mytable.rows.length;

    for( var x = 0; x < mytable.rows[0].cells.length; x++ ) {
        colWdth=mytable.rows[0].cells[x].offsetWidth;
        mytable.rows[0].cells[x].setAttribute("width", colWdth + 10);
    }
}

function right(up) {
    if(up) {
        window.clearTimeout(ID);
        return;
    }
    if(!mytable) {
        setUp();
    }

    if(myCol < (myCells)) {
        for( var x = 0; x < noRows; x++ ) {
            mytable.rows[x].cells[myCol].style.display="";
        }
        if(myCol > freezeCol) {
            myCol--;
        }
        ID = window.setTimeout('right()', speed);
    }
}

function left(up) {
    if(up) {
        window.clearTimeout(ID);
        return;
    }
    if(!mytable) {
        setUp();
    }

    if(myCol < (myCells-1)) {
        for( var x = 0; x < noRows; x++ ) {
            mytable.rows[x].cells[myCol].style.display="none";
        }
        myCol++
        ID = window.setTimeout('left()', speed);
    }
}

function down(up) {
    if(up) {
        window.clearTimeout(ID);
        return;
    }
    if(!mytable) {
        setUp();
    }

    if(myRow < (noRows-1)) {
        mytable.rows[myRow].style.display="none";
        myRow++;
        ID = window.setTimeout('down()', speed);
    }
}

function upp(up) {
    if(up) {
        window.clearTimeout(ID);
        return;
    }
    if(!mytable) {
        setUp();
    }
    if(myRow <= noRows) {
        mytable.rows[myRow].style.display="";
        if(myRow > freezeRow) {
            myRow--;
        }
        ID = window.setTimeout('upp()', speed);
    }
}